﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace rbdesign.Model
{
    class ModelSubject
    {
        public static SortedList<int, string> fGetSubjectsList()
        {
            try
            {
                DataTable dt = ModelCRUD.Select("SELECT id,name FROM tblSubject");

                SortedList<int, string> listSubjectNames = new SortedList<int, string>();

                foreach (DataRow drRow in dt.Rows)
                {
                    listSubjectNames.Add(int.Parse(drRow["id"].ToString()),(string)drRow["name"]);
                }

                return listSubjectNames;
            }
            catch (Exception e)
            {
                throw e;
            }
        }
    }
}
